import heatmap
import random
import csv
import sys
import os.path


for n in range(0,96):

	print "Processing: "+str(n)
	
	if os.path.isfile(sys.argv[1]+'/'+str(n)+'.txt') :
	
		cr = csv.reader(open(sys.argv[1]+'/'+str(n)+'.txt'))


		#for row in cr:
		#	print row

		pts = [(float(row[0]),float(row[1])) for row in cr]
		#print pts
			
		#pts = [(random.uniform(-77.012, -77.050), random.uniform(38.888, 38.910)) for x in range(10)]
		#print pts
			
		hm = heatmap.Heatmap()
		hm.heatmap(pts, sys.argv[1]+"/"+str(n)+".png", int(sys.argv[2]), scheme='fire')
		hm.saveKML(sys.argv[1]+"/"+str(n)+".kml")

